//
//  ClubHeaderViewCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2017/7/4.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "ClubHeaderViewCell.h"
#import <UIButton+WebCache.h>

@interface ClubHeaderViewCell ()

@property (weak, nonatomic) IBOutlet UIButton *focusBtn;
@property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
@property (weak, nonatomic) IBOutlet UIImageView *logoView;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *desLab;


@end

@implementation ClubHeaderViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.focusBtn.layer.borderWidth = 1.0f;
        self.focusBtn.layer.borderColor = RGBColor(255, 120, 201).CGColor;
    });
}

- (void)setModel:(ClubModel *)model
{
    _model = model;
    if (self.model.backgroundImg) {
        [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.backgroundImg] placeholderImage:GetImage(@"person_avatar")];
    }
    if (self.model.clubLogo) {
        [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.clubLogo] placeholderImage:GetImage(@"person_avatar")];
    }
    self.titleLab.text = model.clubName;
    self.desLab.text = model.content;
    if (model.keepStatus == 1) {
        self.focusBtn.selected = YES;
    }else {
        self.focusBtn.selected = NO;
    }
}
- (void)setIsShowFocus:(BOOL)isShowFocus
{
    _isShowFocus = isShowFocus;
    self.focusBtn.hidden = !isShowFocus;
}
- (IBAction)focusBtn:(UIButton *)btn
{
    if (self.addFocusBlcok) {
        self.addFocusBlcok(self.model,btn);
    }
}

@end
